package com.hongdee.crm.task.service;

import com.hongdee.crm.car.entity.TCrmCar;
import com.hongdee.crm.task.dao.ITCrmTaskDao;
import com.hongdee.crm.task.entity.TCrmTask;
import com.hongdee.crm.task.entity.TCrmTaskReal;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

/**
 * 名  称:
 * 类  型: class
 * 描  述: 登录相关事项
 * 路  径:com.hongdee.crm.task.service
 * 作  者:liuze
 * 日  期:2017/2/28 10:24
 */
public interface ITCrmTaskService {

    public Integer guanAiShengRi(String companyId, String startTime, String endTime) throws Exception;

    public Integer guanAiZhiBao(String companyId, String startTime, String endTime) throws Exception;

    public Integer guanAiYanBao(String companyId, String startTime, String endTime) throws Exception;

    public Integer liuShi(String companyId, String startTime, String endTime) throws Exception;

    public Integer nianShen(String companyId, String startTime, String endTime) throws Exception;

    public Integer nianShenTest(String companyId, String startTime, String endTime) throws Exception;

    public Integer ciNianJiaoQiang(String companyId, String startTime, String endTime) throws Exception;

    public Integer ciNianShangYe(String companyId, String startTime, String endTime) throws Exception;

    public Integer xuBaoShangYe(String companyId, String startTime, String endTime) throws Exception;

    public Integer xuBaoJiaoQiang(String companyId, String startTime, String endTime) throws Exception;

    public Integer jieDaiShangYe(String companyId, String startTime, String endTime) throws Exception;

    public Integer jieDaiJiaoQiang(String companyId, String startTime, String endTime) throws Exception;

    public Integer baoXianHuoYue(String companyId, String startTime, String endTime) throws Exception;

    public Integer baoXianFeiHuoYue(String companyId, String startTime, String endTime) throws Exception;

    /**
     * 任务查询新版
     *
     * @param uid
     * @param start
     * @param limit
     * @param status
     * @param vin
     * @param title
     * @param pcode
     * @param code
     * @param expectDate
     * @return
     * @throws Exception
     */
    public Map crmCarTaskQuery(String uid, String start, String limit, String status, String vin, String title, String pcode,
                               String code, String expectDate, String area) throws Exception;

    /**
     * 更新车辆任务对应的任务数
     * 根据VIN,SAID来更新
     *
     * @param saId
     * @param companyId
     * @param start
     * @throws Exception
     */
    public void updateCrmCarTaskNums(String saId, String companyId, String start) throws Exception;

    /**
     * 当天 当月查询任务
     *
     * @param start
     * @param limit
     * @param companyId
     * @param pcode
     * @param code
     * @param status
     * @param uid
     * @param day
     * @param month
     * @param platenum
     * @param title
     * @return
     * @throws Exception
     */
    public Map dayAndMonthQueryTask(String start, String limit, String companyId, String pcode, String code, String status, String uid,
                                    String day, String month, String platenum, String title, String vin, String area, String queryExpecDate) throws Exception;

    /****
     * 任务管理查询
     * @param start
     * @param limit
     * @param companyId
     * @param pcode
     * @param code
     * @param uid
     * @param title
     * @param deal
     * @param type
     * @param allotstatus
     * @param assignId
     * @param allotType
     * @param allotTypeV
     * @param taskType
     * @param month
     * @return
     * @throws Exception
     */
    public Map queryMangerPage(String start, String limit, String companyId, String pcode, String code,
                               String uid, String title, String deal, int type, String allotstatus,
                               String assignId, String allotType, String allotTypeV, String taskType, String month, String series, String acTag,String inWx,Map belongsStoreName) throws Exception;

    public TCrmTask saveOrUpdate(TCrmTask data, String uid) throws Exception;

    public TCrmTaskReal saveTeskRel(TCrmTaskReal data, String uid) throws Exception;


    /**
     * 查询任务，用于生成正式任务信息
     *
     * @param start
     * @param limit
     * @return
     * @throws Exception
     */
    public Map searchTask(String typeCode, String typePCode, String title, String plateNum, String companyId,
                          String start, String limit) throws Exception;

    /**
     * 将选定的批量任务迁移至正式表
     *
     * @param data
     * @throws Exception
     */
    public void transferTask(List<Map> data, String companyId) throws Exception;

    /**
     * 将查询的批量任务迁移至正式表
     *
     * @param typeCode
     * @param typePCode
     * @param title
     * @param plateNum
     * @throws Exception
     */
    public void transferTask(String typeCode, String typePCode, String title, String plateNum, String companyId) throws Exception;

    /**
     * 任务处理下拉：所有可处理任务人的及待处理的任务数
     */
    public List<Map> combo(String uid, String companyId, String area, String brand) throws Exception;

    /*
     * 根据公司ID 清除公司上的任务信息
     * @param companyId
     * @throws Exception
     */
    public void cleanTask(String companyId) throws Exception;

    /**
     * 根据公司生成关爱、保养、保险、年审类任务
     *
     * @param companyId
     * @throws Exception
     */
    public void createTask(String companyId, String startTime, String endTime) throws Exception;

    /**
     * 根据车牌号设定规则 更新人员所
     *
     * @throws Exception
     */
    public void countSaIDNums() throws Exception;

    /**
     * 统计各大类 小类的数据量
     *
     * @param companyId
     * @return
     * @throws Exception
     */
    public List<Map<String, Object>> taskCountByType(String companyId) throws Exception;

    /**
     * 检测当前登录人员 与任务处理的车牌号之间的权限
     *
     * @param uid
     * @param companyId
     * @param plateNum
     * @return
     * @throws Exception
     */
    public boolean checkTaskPower(String uid, String companyId, String plateNum) throws Exception;

    public Integer distTask(String pcode, String code, String uid, String title, int type, String allotstatus,
                            String allotType, String allotTypeV, Map data, String saId, boolean force,
                            String deal, String taskType, String series, String acTag) throws Exception;

    XSSFWorkbook createExcel(List<Map<String, Object>> dataList, String uid);


    /**
     * @Name: 获取当天保险任务车牌号
     * @Author: Liu XiaoLong
     * @Date: 2017/12/21 11:34
     * @Remark:
     */
    public Map getPlateNumForInsuranceTaskToday(String uid) throws Exception;

}
